package com.lecture.java8.excel.dyr.n.a003;

import com.alibaba.excel.EasyExcel;
import com.lecture.java8.excel.dyr.n.a001.CompanyData;

import java.util.ArrayList;
import java.util.List;

public class ExcelFilter2 {
    public static void main(String[] args) {
        String path = "D:\\study\\tmp\\1119\\";
        String excelPath = path + "非平衡面板数据.xlsx";

        // 使用EasyExcel读取Excel文件
        List<CompanyData> allData = EasyExcel.read(excelPath).head(CompanyData.class).sheet().doReadSync();

        // 筛选数据
        List<CompanyData> filterList = new ArrayList<>();
        for (CompanyData data : allData) {
            if (!data.getName().contains("*ST") && !data.getName().contains("ST")) {
                filterList.add(data);
            }
        }
        EasyExcel.write(path + "非平衡面板数据(过滤后).xlsx",CompanyData.class).sheet("Sheet1").doWrite(filterList);
    }
}
